#include "server.h"
#include "client.h"

void server::on_client_connect(Socket s)
{
	int id = SessionManger::GetInstance().CreatSessionID();
	ALOGD("New Connection --- SessionID=%d\n", id);
	shared_ptr<Client> clt(new Client(id));
	clt->start(s);
	SessionManger::GetInstance().AddSession(clt);	
}

server::server(const char* ip, int port):dp(nullptr)
{
	dp.Create_Socket();
	dp.Bind(ip, port);
	dp.Listen(on_client_connect);
}


